<?php
	foreach($get_id_status as $row){
		$status = $row["STATUS"];
	}
?>
<style>
#heading{
	padding:20px 0px 40px 0px;
}

</style>
<link type="text/css" rel="stylesheet" href="<?php echo $this->config->item('plugin_path');?>popup/jquery.fancybox.css" />
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>popup/jquery.fancybox.js"></script>
<div class="row">
	<div class="col-lg-11">
		<div class="page-header">
			<h4>Form Tindak Lanjut Pengaduan & Saran</h4>
		</div>
		<div style="margin-bottom: 20px;">
			<ul id="myTab" class="nav nav-tabs pattern">
				<li class="active"><a href="#form1" data-toggle="tab">Form Tindak Lanjut Trouble<?php echo $status;?></a></li>
			</ul>
			<div class="tab-content">
				<div class="row">
					<div class="col-lg-12">
						<div class="panel panel-default">
							<div class="panel-heading">
								<div class="form-group" id="heading">
									<?php echo form_open($post_action);?>
									<div class="col-lg-4">
										<textarea class="form-control elastic" id="form_input" name="form_input" placeholder="Ketikkan sesuatu proses disini..."></textarea>
									</div>
									<div class="col-lg-4">
										<button type="submit" class="btn btn-default" id="submit_proses">Masukkan</button>
										<button type="button" class="btn btn-warning" onClick="kembali()">Kembali</button>
									</div>
									<?php echo form_close();?>
									<div class="col-lg-4">
										<div class="switch" align="right">
											<a class="fancybox" href="#inline1" title="Form Konfirmasi"><button type="button" class="btn btn-info" id="tuntas">Selesai</button></a>
											<button class="btn btn-success" id="selesai" disabled>Proses Selesai</button>
										</div>
									</div>
								</div>
								<br>
							</div>
							
							<div id="inline1" style="width:400px;display: none;">
								<?php echo form_open($post_action2);?>
								<input type="text" value="<?php echo $id;?>" name="id_testimoni" style="display:none;">
								<h3>Konfirmasi Selesai</h3>
								<textarea class="form-control elastic" rows="5" name="testimoni" id="testimoni"></textarea>
								<br>
								<button type="submit" class="btn btn-default">Konfirmasi</button>
								<?php echo form_close();?>
							</div>
							
							<div class="panel-body">
								<?php if($get_data_proses != NULL){?>
									<?php foreach($get_data_proses as $row){ 
										if($row['TESTIMONI'] == 0){ ?>
												<div class="alert alert-info">
													<strong><?php echo date('d/m/Y | H:i:s', strtotime($row["TANGGAL"]));?></strong>&nbsp;&nbsp;&nbsp;<?php echo $row["KETERANGAN_A"];?>
												</div>
											<?php
										}elseif($row['TESTIMONI'] == 1){ ?>
												<div class="alert alert-success">
													<strong><?php echo date('d/m/Y | H:i:s', strtotime($row["TANGGAL"]));?></strong>&nbsp;&nbsp;&nbsp;<?php echo $row["KETERANGAN_A"];?>
												</div>
											<?php
										}
									}
								}else{
									echo '
										<div class="alert alert-warning">
											<strong>Maaf ,</strong> sepertinya belum ada kegiatan apapun :(
										</div>
									';
								}
								?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
var status = "<?php echo $status;?>";

function kembali(){
	document.location="<?php echo site_url("history_trouble/grid_history_trouble");?>";
}
$(document).ready(function() {
	
	$('.fancybox').fancybox();
	$('#selesai').hide();
	
	if(status == 1){
		$('#selesai').show();
		$('#tuntas').hide();
		document.getElementById("form_input").disabled=true;
		document.getElementById("submit_proses").disabled=true;
	}else if(status == 2){
		document.getElementById("tuntas").disabled=false;
		document.getElementById("form_input").disabled=false;
		document.getElementById("submit_proses").disabled=false;
	}
});
</script>